"""
@文件: role.py
@Author: ZJJ
@Email: 1065377805@qq.com
@Time: 2025/3/29
@Des:
"""
from datetime import datetime
from typing import Optional, List

from pydantic import BaseModel, Field

from schemas.base import ResAntTable


class CreateRole(BaseModel):
    role_name:str = Field(min_length=3,max_length=10)
    role_status:Optional[bool] = False
    role_desc:Optional[str] = Field(max_length=255)

class UpdateRole(BaseModel):
    id:int
    role_name:str
    role_status:Optional[bool]
    role_desc:Optional[str]

class RoleItem(BaseModel):
    id:int
    key: int
    role_name:str
    role_status:Optional[bool]
    role_desc:Optional[str]
    create_time:datetime
    update_time: datetime


class RoleList(ResAntTable):
    data: List[RoleItem]


class SetAccess(BaseModel):
    role_id: int
    access: List[int] = Field(default=[], description="权限集合")


class CreateAccess(BaseModel):
    access_name: str = Field("测试", description="权限名称")
    scopes: str = Field("test", description="权限标识")
    parent_id: int = 0
    menu_path: str = "/"
    is_check: bool = False
    is_menu: bool = False